Dynomotion

Group: DynoMotion Message: 7 From: strohm81 Date: 12/7/2008
Subject: Triggering E-stop with input
When using a VFD that has the ability to output a logic signal when a
fault occurs, is it possible to have KMotionCNC read the input an
execute a program that duplicates or triggers the E-stop button on the
main page to prevent scrapped parts and broken cutters? What would the
C code look like to do something like that? Or is there an easier way
to do it?
Group: DynoMotion Message: 8 From: Tom Kerekes Date: 12/8/2008
Subject: Re: Triggering E-stop with input
It's not clear what would give the best result, to do a feedhold or kill all the axes?
 
Below is some "watchdog" code  that runs continuously and when it sees an input change issues a feedhold (StopCoordinatedMotion()).  Add the "for" loop to the end of your Init.c program so after your initialization the loop will continue to run.
 
You might also try replacing the StopCoordinatedMotion with:
 
DisableAxis(0); 
DisableAxis(1); 
DisableAxis(2); 
 
which would act more like estop.
 
I hope this helps.
 
TK
 
 
 
#include "KMotionDef.h"
main()
{
     int fault=0;
 
     for (;;)     // repeat forever
     {
          WaitNextTimeSlice(); // execute one loop per time slice
  
          // check external fault signal
  
          if (!fault && ReadBit(19)) 
          {
               fault=1;  // remember we are in a fault state
               StopCoordinatedMotion();  // do a feed hold  
          }
          if (fault && !ReadBit(19))
          {
               fault=0;  // remember we are no longer in a fault state
          }
     }
}